home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / OpenDoc 1.2b2c1 / TestParts / Draw / DrawPrt2.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-01  |  2.6 KB  |  132 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        DrawPrt2.cpp
  3.  
  4.     Contains:    More implementation code for Container.
  5.  
  6.     Owned by:    Nick Pilch
  7.  
  8.     Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <3>     9/14/95    TJ        #included ODSessn.xh, Frame.xh, and
  13.                                     StorageU.xh so it will compile with out Pre
  14.                                     Compiled Headers.
  15.          <2>     9/13/95    NP        1269380: Crash with TSMTE and modified
  16.                                     dialogs.
  17.          <1>     9/13/95    NP        first checked in
  18.  
  19.     To Do:
  20. */
  21.  
  22. #ifndef _DRWSHARED_
  23. #include "DrwShared.h"
  24. #endif
  25.  
  26.  
  27. #ifndef SOM_Module_OpenDoc_Foci_defined
  28. #include "Foci.xh"
  29. #endif
  30.  
  31.  
  32. #ifndef SOM_ODArbitrator_xh
  33. #include "Arbitrat.xh"
  34. #endif
  35.  
  36. #ifndef SOM_ODWindowState_xh
  37. #include "WinStat.xh"
  38. #endif
  39.  
  40.  
  41. #ifndef _USERSRCM_
  42. #include "UseRsrcM.h"
  43. #endif
  44.  
  45.  
  46. #ifndef __DIALOGS__
  47. #include <Dialogs.h>
  48. #endif
  49.  
  50. #ifndef SOM_ODSession_xh
  51. #include <ODSessn.xh>
  52. #endif
  53.  
  54. #ifndef SOM_ODFrame_xh
  55. #include <Frame.xh>
  56. #endif
  57.  
  58. #ifndef SOM_ODStorageUnit_xh
  59. #include <StorageU.xh>
  60. #endif
  61.  
  62. #define kTSMTETestDialogID 5057
  63. #define kOKButton 1
  64.  
  65. //------------------------------------------------------------------------------
  66. // BringUpTSMTETestDialog
  67. //------------------------------------------------------------------------------
  68.  
  69. void BringUpTSMTETestDialog(Environment* ev, AppleTest_Container* somSelf,
  70.                                 ODFrame* frame)
  71. {
  72.     ODSession* session = frame->GetStorageUnit(ev)->GetSession(ev);
  73.     
  74.     // Our About box is modal so we must request the Modal focus to prevent
  75.     // multiple modal dialogs being displayed simultaneously.
  76.     
  77.     if ( session->GetArbitrator(ev)->RequestFocus(ev,
  78.             session->Tokenize(ev, kODModalFocus), frame) )
  79.     {
  80.         ODSShort        itemHit;
  81.  
  82.         session->GetWindowState(ev)->DeactivateFrontWindows(ev);
  83.             // Dim the frontmost document window.
  84.                 
  85.         ODSLong rfRef;    
  86.         rfRef = BeginUsingLibraryResources();
  87.         {            
  88.             DialogPtr dialog = GetNewDialog(kTSMTETestDialogID, NULL,
  89.                                             (WindowPtr)-1L);
  90.             if (!dialog)
  91.             {
  92.                 SysBeep(10);
  93.                 return;
  94.             }
  95.             
  96.             ShowWindow(dialog);
  97.             
  98. //            ModalFilterUPP otherDialogProc = NewModalFilterProc(OtherDialogFilter);
  99.                 
  100.             ODBoolean    done = kODFalse;
  101.             
  102.             while (!done)
  103.             {
  104.                 ModalDialog(NULL, &itemHit);
  105.                 
  106.                 switch (itemHit) {
  107.                     case kOKButton:                            
  108.                         done = kODTrue;
  109.                         break;
  110.                                 
  111.                     default:
  112.                         break;
  113.                 }
  114.             }
  115.     
  116. //            DisposeRoutineDescriptor(otherDialogProc);
  117.  
  118.             DisposeDialog(dialog);
  119.     
  120.             session->GetArbitrator(ev)->RelinquishFocus(ev,
  121.                                 session->Tokenize(ev, kODModalFocus), frame);
  122.                 // Inform the Arbitrator that we no longer require the Modal
  123.                 //    focus.
  124.             
  125.             session->GetWindowState(ev)->ActivateFrontWindows(ev);
  126.                 // Hilite the frontmost document window.
  127.         }
  128.         EndUsingLibraryResources(rfRef);
  129.     }
  130. }
  131.  
  132.